package com.example.demo.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * plus分页插件
 *
 * @Author: jamie.w
 * @CreateDate: 2021/11/23 11:40
 */
@Configuration
@Slf4j
public class MybatisPlusConfig {

  /**
   * mybatis-plus分页插件
   */
  @Bean
  public PaginationInterceptor paginationInterceptor() {
    log.info("注册分页插件");
    PaginationInterceptor page = new PaginationInterceptor();
    page.setDbType(DbType.getDbType("mysql"));
    return page;
  }
}